package com.powernode.springboot;

import com.powernode.springboot.bean.Vip;
import com.powernode.springboot.service.VipService;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@MapperScan(basePackages = {"com.powernode.springboot.repository"})
@SpringBootApplication
public class Springboot3004MybatisApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext applicationContext = SpringApplication.run(Springboot3004MybatisApplication.class, args);
		VipService vipService = applicationContext.getBean(VipService.class);

		Vip vip1 = new Vip("jack","123","1999-10-10");
		vipService.save(vip1);
		Vip vip2 = new Vip("lucy","456","2001-10-10");
		vipService.save(vip2);
		vipService.findAll().forEach(System.out::println);

		applicationContext.close();
	}

}
